@extends('layout.home')

@section('title','商品订单')

@section('content')
	<style type="text/css">
		.field{
			margin:0px;
			/*border:solid 1px blue;*/
		}
		
		.orders{
			/*border:solid 1px #ddd;*/
		}
		.order-header{
			background:#eaf8ff;
		}
		.order-time{
			    font-style: normal;
			    font-variant: normal;
			    font-weight: normal;
			    font-stretch: normal;
			    font-size: 12px;
			    line-height: 1.5;
			    font-family: tahoma, arial, 'Hiragino Sans GB', '\\5B8B体', sans-serif;
			    margin-right: 10px;
    			font-weight: 700;
				color: #3c3c3c;
		}
		tr td{
			line-height:20px;
			padding-top:10px;
			padding-bottom:10px;
			color:#444;
			/*border:solid 1px #555;*/
		}
		#goods_title{
			/*display: block;
		    -webkit-margin-before: 1em;
		    -webkit-margin-after: 1em;
		    -webkit-margin-start: 0px;
		    -webkit-margin-end: 0px;
		    /*margin-top: 8px;*/
		    margin-bottom: 8px;
		    line-height: 1;*/
		}
		#goods-color-size,#orinal-price{
			color: #9c9c9c;
		}
		.batch-recieve{
			margin-bottom:10px;
		}
		.batch-recieve-btn{
			background-color: white;
		    border: 1px solid #dcdcdc;
		    color: #3c3c3c;
		    display: inline-block;
		    height: 28px;
		    line-height: 26px;
		    padding: 0 12px;
		    border-radius: 3px;
		    cursor: pointer;
		    text-decoration: none;
		    text-transform: none;
		}
		table p{
			/*margin:0px;*/
		}
		.comments a {
			display:inline-block;
			width:70px;
			height:40px;
			line-height:40px;
			border:solid 1px #aaa;
			text-decoration:none;
			font-weight:bold;
		}
		.container .active{
			border:solid 1px #ff1d00;
			color:#ff1d00;
			
		}
		.bothside{
			border-right:solid 1px #aaa;
			border-left:solid 1px #aaa;
		}
		.allside{
			border:solid 1px #aaa;
		}
		.topbotside{
			border-top:solid 1px #aaa;
			border-bottom:solid 1px #aaa;
		}
		.botside{
			border-bottom:solid 1px #aaa;
		}
	</style>
	<script type="text/javascript">
		$(function(){
			//评价样式
			$('.comments a').mouseover(function(){
				$(this).addClass('active');
			});

			$('.comments a').mouseout(function(){
				$(this).removeClass('active');
			});

			//批量确认收货的样式
			$('.batch-recieve-btn').mouseover(function(){
				$(this).addClass('active');
			});
			$('.batch-recieve-btn').mouseout(function(){
				$(this).removeClass('active');
			});

			//删除订单
			$('.delete').mouseover(function(){
				$(this).css({'color':'#ff1d00','cursor':'pointer'});
			});
			$('.delete').mouseout(function(){
				$(this).css('color','#444444');
			});
			$('.delete').click(function(){
				var ordid = $(this).attr('ordid');
				$.get('/home/order/delete',{'ordid':ordid},function(data){
					if(data == 1){
						$('#'+ordid).remove();
						alert('删除成功');
					}else{
						alert('删除失败');
					}
				});
			});
		});
	</script>
<div class="container">
	<div class="check-out">
	    
		<ul class="nav nav-pills" role="tablist">
	        <li role="presentation" class="active"><a href="#">Home <span class="badge">42</span></a></li>
	        <li role="presentation"><a href="#">Profile</a></li>
	        <li role="presentation"><a href="#">Messages <span class="badge">3</span></a></li>
	    </ul>
	    <hr>

	    <table class="text-center field ">
	    
	    	<tbody>
	    		<tr>
	    			<td width="435px">宝贝</td>
	    			<td width="86px">单价</td>
	    			<td width="70px">数量</td>
	    			<td width="150px">商品操作</td>
	    			<td width="88px">实付款</td>
	    			<td width="192px">交易状态</td>
	    			<td>交易操作</td>
	    		</tr>
	    	</tbody>
	    </table>
	    <div class="batch-recieve">
	    	<input type="checkbox" name="" value="">&nbsp; <span>全选</span>&nbsp;&nbsp;<button class="batch-recieve-btn">批量确认收货</button>
	    </div>
	    @foreach($orders as $k=>$v)
	    <div id="{{$v->id}}">
	    <table class="text-center orders allside">
            <tbody>
	            <tr class="order-header">
	                <td class="text-left"><input type="checkbox" name="" value="">&nbsp;<span class="order-time">{{date('Y-m-d'),$v->time}}</span> &nbsp;&nbsp;订单号:{{$v->order_num}}</td>
	                <td colspan=2></td>
	                <td>
	                	<!-- <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1923473790&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:1923473790:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> -->
	                </td>
	                <td colspan=2></td>
	                
	                
	                <td><span class="glyphicon glyphicon-trash delete" ordid="{{$v->id}}"></span></td>
	            </tr>
            </tbody>
            @foreach($v->info as $kk=>$vv)
            <tbody>
	            <tr>
	                <td style="width:435px" class="ring-in text-left botside">
	                    <a href="/home/detail/{{$vv->goods_id}}.html" class="at-in">
	                        <img src="{{$vv->path}}" class="img-responsive" alt="">
	                    </a>
	                    <div class="">
	                        <p id="goods_title"><a href="/home/detail/{{$vv->goods_id}}.html?goods_id={{$vv->goods_id}}">
	                        	<span>{{$vv->title}}<span>
	                        </a></p>
	                        <p id="goods-color-size">
	                        	<span>颜色分类:{{$vv->goods_color}}</span>
	                        	<span>尺码:{{$vv->goods_size}}</span>
	                        </p>
	                    </div>
	                    <div class="clearfix"></div>
	                </td>
	                <td width="70px" class="check botside">
	                	<span id="orinal-price"><s>￥{{$vv->price*1.5}}</s></span>
	                	<span>￥{{$vv->price}}</span>
	                </td>
	                <td width="70px" class="botside"><span>{{$vv->num}}</span></td>
					
					
	                <td class="botside" kh="{{count($v->info)}}" width="150px"><div><a href="#"><span>退款/退货</span></a></div></td>
	                


	                
	                @if($kk==0)
	                <td class="bothside" kh="{{count($v->info)}}" width="88px">￥{{total($v->id)}}</td>
	                <td class="bothside" kh="{{count($v->info)}}" width="192px">
						<div>
							<p><span>{{getAddress($v->status)}}</span></p>
							<div>
								<p><a href="#">订单详情</a></p>
								<p><a href="#">查看物流</a></p>
							</div>
						</div>
	                </td>
	                @else
	                 <td class="bothside" width="88px"></td>
	                <td class="bothside" width="192px"></td>
	                @endif
					
	                @if($v->status==3)
                	
            		@if(empty($vv->comsta))
            		<td class="comments botside" kh="">
                		<a href="/goods/comment?orderid={{$v->id}}&goodsid={{$vv->goods_id}}">评价</a>
                	</td>
                	@else
					<td class="comments botside" kh="" style="width:120px">已评价</td>
                	@endif
	                
					
	                @elseif($v->status == 1 || $v->status == 2)
	                @if($kk==0)
	                <td class="">
	                	<a href="/receipt/confirm?orderid={{$v->id}}"><button type="button" class="btn btn-1 btn-primary">确认收货</button></a>
	                </td>
	                @else
	                <td></td>
	                @endif

	                @elseif($v->status == 0)
	                @if($kk==0)
	                <td class="">
	                	<a href="/home/order/confirm?order_id={{$v->id}}"><button type="button" class="btn btn-1 btn-primary">立即付款</button></a>
	                </td>
	                @else
	                <td></td>
	                @endif

	                @endif
	            </tr>
        	</tbody>
        	@endforeach
	    </table>
	    </div>
	    @endforeach
		
	    <div class="clearfix"></div>
	</div>
</div>
@endsection

@section('js')
@endsection